package com.iflytek.cosmo.ocr.web.controller;

import java.util.HashMap;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iflytek.cosmo.ocr.common.config.FdfsProperties;
import com.iflytek.cosmo.ocr.service.ArgusPostService;

/**
 * 语音助手工具配置信息controller
 * 
 * @author yunsun
 *
 */
@Api("语音助手工具配置信息")
@RestController
@RequestMapping(value = "/config")
public class ConfigController {

	/**
	 * 日志记录器
	 */
	private final Logger logger = LoggerFactory.getLogger(ConfigController.class);

	/**
	 * FdfsProperties
	 */
	@Autowired
	private FdfsProperties fdfsProperties;

	/**
	 * ArgusPostService
	 */
	@Autowired
	private ArgusPostService argusPostService;

	/**
	 * 获取配置信息
	 * 
	 * @return 配置信息
	 */
	@ApiOperation(value = "获取配置信息", httpMethod = "GET")
	@GetMapping(value = "/info")
	public Map<String, Object> getConfigInfo() {
		logger.debug("------ 获取配置信息 ------");
		Map<String, Object> info = new HashMap<String, Object>();
		info.put("fastdfs", fdfsProperties.getFdfsDownloadUrl());

		return info;
	}

	@ApiOperation(value = "发送埋点数据", httpMethod = "GET")
	@GetMapping(value = "/send/data")
	private void sendData() {
		argusPostService.postAgent("172.0.0.3", "weizhou", "iflytek.ocr", "", null);
	}
}
